package com.woniuxy.his.mapper;

import com.woniuxy.his.entity.CheckDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.his.vo.CheckDetailsVo;
import com.woniuxy.his.vo.CheckPayVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 检查详情表 Mapper 接口
 * </p>
 *
 * @author Lucas
 * @since 2021-08-24
 */
public interface CheckDetailMapper extends BaseMapper<CheckDetail> {

    @Select("select hp.patient_name,hp.patient_age,hp.patient_gender,hp.patient_id_card,hd.doctor_name,hd.doctor_tel,hi.item_name,hdt.dep_name,hi.item_id " +
            "from his_check hc " +
            "join his_check_detail hcd " +
            "join his_item hi " +
            "join his_doctor hd " +
            "join his_case hcase " +
            "join his_patient hp " +
            "join his_department hdt " +
            "on hc.case_id = hcase.case_id " +
            "and hcase.patient_id = hp.patient_id " +
            "and hc.check_id = hcd.check_id " +
            "and hcd.item_id = hi.item_id " +
            "and hcd.doctor_id = hd.doctor_id " +
            "and hd.dep_id = hdt.dep_id " +
            "WHERE hcd.check_detail_id = #{checkDetailId}")
    CheckDetailsVo inspectShoutByCheckDetailId(Integer checkDetailId);


    @Select("SELECT hc.check_id,hc.rwa_add_time,hc.total_price,hcd.item_name,hcd.check_price " +
            "from his_check hc,his_check_detail hcd " +
            "where hc.check_id=#{checkId} and hc.ispaid='no' and hc.check_id = hcd.check_id")
    List<CheckPayVo> showCheckMsgByCheckId(Integer checkId);
}
